package com.bajiao.vo.order;

import com.alibaba.fastjson.annotation.JSONField;
import com.bajiao.common.aspect.annotation.Dict;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
@ApiModel("OrderAdmin")
public class OrderAdmin {

    private String id;

    @Excel(name = "订单编号", width = 30, needMerge = true)
    private String orderNo;

    @Excel(name = "用户昵称", width = 30, needMerge = true)
    private String nickname;

    @Excel(name = "用户手机号", width = 30, needMerge = true)
    private String mobile;

    @Dict(dictTable ="tb_store",dicText = "title",dicCode = "id")
    @Excel(name = "店铺名称", width = 30, dictTable = "tb_store",dicCode = "id",dicText = "title", needMerge = true)
    private String storeId;

    @ExcelCollection(name = "商品详情")
    private List<OrderDetailsAdmin> orderDetails;

    @Excel(name = "购买总量", width = 15, needMerge = true)
    private Integer buyNum;

    @Excel(name = "商品总价", width = 15, needMerge = true)
    private BigDecimal productAmount;

    @Excel(name = "订单金额", width = 15, needMerge = true)
    private BigDecimal orderAmount;

    @Excel(name = "优惠金额", width = 15, needMerge = true)
    private BigDecimal discountAmount;

    @Excel(name = "实付金额", width = 15, needMerge = true)
    private BigDecimal payPrice;

    @ApiModelProperty("支付时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "支付时间", width = 30, format = "yyyy-MM-dd HH:mm:ss", needMerge = true)
    private Date payTime;

    @Excel(name = "支付方式", width = 15, replace = {"余额_1","微信_2"}, needMerge = true)
    private Integer payType;

    @ApiModelProperty("下单时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "下单时间", width = 30, format = "yyyy-MM-dd HH:mm:ss", needMerge = true)
    private Date createTime;

    @ApiModelProperty("核销时间")
    private Date verifyTime;

    @Excel(name = "订单状态", width = 15, replace = {"待支付_0","待使用_1","已使用_2", "退款中_7", "已退款_8", "已取消_9"}, needMerge = true)
    private Integer status;
}
